<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者，助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件，未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------

use think\facade\Route;
use app\common\middleware\AdminAuthMiddleware;
use app\common\middleware\AdminTokenMiddleware;
use app\common\middleware\AllowOriginMiddleware;
use app\common\middleware\LogMiddleware;

Route::group(function () {

    //平台
    Route::group('ad/advert', function () {


        Route::get('lst', '/lst')->name('systemAdPageAdvertLst')->option([
            '_alias' => '列表 ',
        ]);

        Route::get('options', '/options')->option([
            '_alias' => '列表 ',
            '_auth' => false,
        ]);

        Route::get('form', '/createForm')->name('systemAdPageAdvertCreateForm')->option([
            '_alias' => '添加表单',
            '_auth' => false,
            '_form' => 'systemDiyPageCategroyCreate',
        ]);
        Route::post('create', '/create')->name('systemAdPageAdvertCreate')->option([
            '_alias' => '添加',
        ]);

        Route::get(':id/form', '/updateForm')->name('systemAdPageAdvertUpdateForm')->option([
            '_alias' => '编辑表单',
            '_auth' => false,
            '_form' => 'systemDiyPageCategroyUpdate',
        ]);
        Route::post('update/:id', '/update')->name('systemAdPageAdvertyUpdate')->option([
            '_alias' => '编辑',
        ]);

        Route::post('status/:id', '/switchStatus')->name('systemAdPageAdvertStatus')->option([
            '_alias' => '编辑状态',
        ]);
        Route::delete('delete/:id', '/delete')->name('systemAdPageAdvertDelete')->option([
            '_alias' => '删除',
        ]);

    })->prefix('admin.system.ad.PageAdvert')->option([
        '_path' => '/setting/ad/advert/list',
        '_auth' => true,
    ]);

    })->middleware(AllowOriginMiddleware::class)
    ->middleware(AdminTokenMiddleware::class, true)
    ->middleware(AdminAuthMiddleware::class)
    ->middleware(LogMiddleware::class);
